package com.tsd.job.entity;

import io.swagger.annotations.ApiModel;
import org.quartz.JobKey;
import org.quartz.TriggerKey;

import java.io.Serializable;
import java.util.List;

/**
 * 定时任务扩展
 *
 * @author huawei
 * @date 2022/02/20 16:29:26
 */
@ApiModel(description = "定时任务扩展")
public class SysTaskJobExt extends SysTaskJob implements Serializable {
    /**
     * 任务类型
     */
    final public static Integer TASK_TYPE_SIMPLE = 0;
    final public static Integer TASK_TYPE_CRON = 1;
    final public static Integer TASK_TYPE_SIMPLE_INTERVAL_MS = 60000;
    /**
     * 任务状态，0-禁用，1-启用
     */
    final public static Integer TASK_STATE_DISABLE = 0;
    final public static Integer TASK_STATE_ENABLE = 1;

    private List<String> sid_list;

    public List<String> getSid_list() {
        return sid_list;
    }

    public void setSid_list(List<String> sid_list) {
        this.sid_list = sid_list;
    }

    public String getJobBeanName() {
        return String.format("sys_task_job_%s_%s_%s", this.getJob_object_name(), this.getJob_method_name(), this.getId());
    }

    public JobKey getJobKey() {
        return new JobKey(this.getJobBeanName());
    }

    public String getTriggerBeanName() {
        return String.format("sys_task_trigger_%s_%s_%s", this.getJob_object_name(), this.getJob_method_name(), this.getId());
    }

    public TriggerKey getTriggerKey() {
        return new TriggerKey(this.getTriggerBeanName());
    }
}
